Software testing is performed to ensure that a software product has been developed and implemented correctly and performs as expected. Testing of software product code elements is continuous throughout the development cycle, but the complexity of testing increases as code elements are integrated into modules and larger portions of the full software product in which higher levels of code interaction occur.
Exhaustive testing can be very time consuming and corrections of defects found may require extensive retesting due to interconnection of code elements.
Approaches to software testing use measurement of test coverage of the source code to indicate a thoroughness of testing. In some cases of highly complex software, testing may selectively cover specific areas of code, functions, or conditions, rather than performing a full coverage of testing. The portions of source code perceived to be complex may be given priority over more common and straight-forward portions of code, which may see only minimal testing. This is done to control the time requirements of testing.
Code coverage indicates the degree to which the source code has been tested and is often expressed in comparison or percentage of “lines of code” tested, of a total number of lines of code in the source code. Coverage criteria can add to the approach and strategy of software testing. Common coverage criteria can include calling each function in the code, executing nodes and edges of the program, and performing control structure evaluations.
Code coverage tools are available for use in software testing. Some calculate the percentage of code accessed by tests, while others promote testing of conditional code statements through possible options. Still other tools determine a complexity level of source code portions based on the presence, number, and amount of nesting, and attempt to prioritize testing based on this perceived complexity.